<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

	<head>
		<base href="<%=basePath%>">

		<title>试题管理页面</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<link rel="stylesheet" href="css/font-awesome/css/font-awesome.css" />
		<link rel="stylesheet" href="css/common.css" />
		<link rel="stylesheet" href="css/contenRight.css" />
		<link rel="stylesheet" href="css/responsive.css" />
		<script type="text/javascript" src="js/jquery.min.js"></script>
		<script type="text/javascript" src="js/index.js"></script>
		<script type="text/javascript" src="js/app.js"></script>
		<link rel="stylesheet" href="css/pulg/jquery-ui/jquery-ui.min.css" />
		<script type="text/javascript" src="css/pulg/jquery-ui/jquery-ui.min.js"></script>
		
	</head>
	<script type="text/javascript">
		function submitFrom() {
			var subjectTitle = document.getElementById("subjectTitle").value;
			var subjectOptionA = document.getElementById("subjectOptionA").value;
			var subjectOptionB = document.getElementById("subjectOptionB").value;
			var subjectOptionC = document.getElementById("subjectOptionC").value;
			var subjectOptionD = document.getElementById("subjectOptionD").value;
 			if(subjectTitle=="" || subjectOptionA=="" || subjectOptionB=="" || subjectOptionC=="" || subjectOptionD==""){
				alert("重要信息不能为空！");
			}else{
				$("#submitForm").attr("action","subjectAdd");
				$("#submitForm").submit();
			}
		}
		$(function() {
			$("#questionRadioGloup").buttonset();
		});
	</script>

	<body style="overflow:-Scroll;overflow-x:hidden;overflow-y: hidden;">
		<div class="list-page">
			<div class="list-page-content">
				<div class="taskTabs">
					<ul class="taskOptions">
						<li>
							<a class="btnlist tabs selected" href="#overtime0" id="taskList">
								<i class="icon-user"></i> 试题信息
							</a>
						</li>

						<li>
							<a class="btnAdd permissions_add tabs" href="#overtime1" id="taskAdd"><i class="icon-plus"></i>新的试题添加</a>
						</li>
						
						
					</ul>
					<div class="clear"></div>
					<div id="overtime0" class="task" data-pattern="priority-cloumns" style="display: block;">
						<table class="list-page-content-table datalist">
							<thead>
								<tr>
									<th>试题编号</th>
									<th>试题标题</th>
									<th>正确答案</th>
									<th>操作</th>

								</tr>
							</thead>

							<tbody>
								<s:iterator value="#request.subjects" var="subject">
									<tr align="center">
										<td>${subject.subjectID}</td>
										<td>${subject.subjectTitle}</td>
										<td>${subject.subjectAnswer}</td>
										<td>
											<a class="editIcon" href="subjectParticular?subjectID=${subject.subjectID}"><i class="icon-search"></i></a>
											<a class="editIcon permissions_update" href="subjectUpadateBefore?subjectID=${subject.subjectID}"><i class="icon-edit"></i></a>
											<a class="deleteIcon permissions_delete" href="subjectDelete?subjectID=${subject.subjectID}&currentPage=${page.currentPage }"><i class="icon-trash"></i></a>
										</td>
									</tr>
								</s:iterator>
							</tbody>
						</table>
						<div class="list-page-content-table-paginate">
							<div class="p_pageBox pages">
								<s:if test="#request.page.hasPrePage">
									<a class="p_prev" href="subjectQuery?currentPage=${page.currentPage - 1}">上一页</a>
								</s:if>
								<s:else>
									<a class="p_prev">上一页</a>
								</s:else>
								<c:forEach varStatus="stat" begin="1" end="${page.totalPage}">
									<s:if test="subjectTitle == null">
										<a href="subjectQuery?currentPage=${stat.index}">${stat.index}</a>
									</s:if>
									<s:else>
										<a href="subjectQuery?currentPage=${stat.index}">${stat.index}</a>
									</s:else>
								</c:forEach>
								<s:if test="#request.page.hasNextPage">
									<a class="p_next" href="subjectQuery?currentPage=${page.currentPage + 1}">下一页</a>
								</s:if>
								<s:else>
									<a class="p_next">下一页</a>
								</s:else>
							</div>
						</div>
						<div class="clear"></div>
					</div>
					<div id="overtime1" class="task" data-pattern="priority-cloumns" style="display: none;">
						<div class="editPage">
							<div class="editPages">
								<div class="editPageTitle">
									<p class="titleLeft">
										<i class="icon-list-alt"></i>
										<span>新的试题</span>
									</p>
									<p class="titleRight">
										<i class="toggleBox icon-chevron-up"></i>
									</p>
									<div class="clear"></div>
								</div>

								<div class="editPageInfo" style="display: block;">
									<form class="form-horizontal editForm" id="submitForm">
										<div class="control-group">
											<label class="control-label">
											<span class="necessary">*</span>
											试题题干：
											</label>
											<div class="controls">
												<input class="m-wrap editP" id="subjectTitle"  name="subjectTitle" type="text" placeholder="请输入题目！" pattern=""  />
											</div>
										</div>
										<div class="control-group">
											<label class="control-label">
											<span class="necessary">*</span>
											选项A：
											</label>
											<div class="controls">
												<input class="m-wrap editP" id="subjectOptionA"  name="subjectOptionA" type="text" />
											</div>
										</div>
										<div class="control-group">
											<label class="control-label">
											<span class="necessary">*</span>
											选项B：
											</label>
											<div class="controls">
												<input class="m-wrap editP" id="subjectOptionB" name="subjectOptionB" type="text" />
											</div>
										</div>
										<div class="control-group">
											<label class="control-label">
											<span class="necessary">*</span>
											选项C：
											</label>
											<div class="controls">
												<input class="m-wrap editP" id="subjectOptionC" name="subjectOptionC" type="text" />
											</div>
										</div>
										<div class="control-group">
											<label class="control-label">
											<span class="necessary">*</span>
											选项D：
											</label>
											<div class="controls">
												<input class="m-wrap editP" id="subjectOptionD"  name="subjectOptionD" type="text" />
											</div>
										</div>
										<div class="control-group">
											<label class="control-label"><span class="necessary">*</span>答案：</label>
											<div class="controls" id="questionRadioGloup">
												<label for="answerRadio1_edit" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only " role="button">
													<span class="ui-button-text">A</span>
												</label>
												<input type="radio" id="answerRadio1_edit" name="subjectAnswer" value="A" class="ui-helper-hidden-accessible" checked="checked"/>
												<label for="answerRadio2_edit" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only " role="button">
													<span class="ui-button-text">B</span>
												</label>
												<input type="radio" id="answerRadio2_edit" name="subjectAnswer" value="B" class="ui-helper-hidden-accessible" />
												<label for="answerRadio3_edit" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only " role="button">
													<span class="ui-button-text">C</span>
												</label>
												<input type="radio" id="answerRadio3_edit" name="subjectAnswer" value="C" class="ui-helper-hidden-accessible" />
												<label for="answerRadio4_edit" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only " role="button">
													<span class="ui-button-text">D</span>
												</label>
												<input type="radio" id="answerRadio4_edit" name="subjectAnswer" value="D" class="ui-helper-hidden-accessible" />
											</div>

										</div>
										<div class="control-group">
											<label class="control-label">
												答案解析：
											</label>
											<div class="controls">
												<textarea rows cols class="m-wrap editP" name="subjectParse" placeholder="请输入答案解析!"></textarea>
											</div>
										</div>
									</form>

								</div>
							</div>
							<div class="submitBtn">
								<a class="btn blue btnEdit editP" onclick="submitFrom()">
									<i class="icon-ok"></i>提交
								</a>
								<a class="btn btnReturn" href="subjectQuery">
									<i class="icon-remove"></i>取消
								</a>
							</div>

						</div>
					</div>
				
				</div>

			</div>
		</div>
	</body>

</html>